const fs = require('fs');
const Vue = require('vue');
const { createRenderer } = require('vue-server-renderer');

const app = new Vue({
  template: `<div>Hello World</div>`
});

const renderer = createRenderer({
  template: fs.readFileSync('./index.template.html', 'utf-8') // 同步读取文件
});

renderer.renderToString(app, (err, doc) => {
  if (err) throw err
  console.log(doc)
})
